# -*- coding: utf-8 -*-


def str2float(s1):
    # str: 1,234,567.41234
    t = s1.replace(',', '')
    return float(t)


def float2str(f1):
    # result: 1,234,567.41
    tmp = '{:.2f}'.format(f1)
    lr = tmp.split('.')
    left = lr[0]
    right = lr[1]

    left_len = len(left)
    step = 3
    x = []

    first_len = left_len % step
    if first_len > 0:
        first = left[0:first_len]
        x.append(first)

    total_step = left_len / step
    index = 0
    while index < total_step:
        x.append(left[first_len + index * step: first_len + (index + 1) * step])
        index += 1

    return ','.join(x) + '.' + right


def str_add(s1, s2):
    f1 = str2float(s1)
    f2 = str2float(s2)
    return float2str(f1 + f2)


def str_div(s1, s2):
    f1 = str2float(s1)
    f2 = str2float(s2)
    return float2str(f1 / f2)


def str_mul(s1, s2):
    f1 = str2float(s1)
    f2 = str2float(s2)
    return float2str(f1 * f2)
